<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>项目列表</title>
</head>
<body>

<div class="container">

    <div class="comm_crub">
        <span class="now_crub">项目列表</span>
    </div>

    <div class="comm_content">
            <div class="search-box">
                <div style="position:relative">
                    <form id="search_form" onsubmit="return false;">
                        <table style="width:100%;">
                            <tbody>
                            <tr>
                                <td>
                                    <span>项目名称：<input type="text" name="projectName" id="projectName" value="" style="width:150px;"></span>


                                    <span><input type="button" value="查询" id="searchBtn" class="btn" onclick="projectList.search()" /></span>

                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>

            <table id="flex" style="display:none"></table>

        </div>

</div>

<script type="text/javascript">
    $("#flex").flexigrid({
        url:"/invokingAjax-backend/project/projectList.ajax?operFlg=1",
        dataType: "json",
        colModel : [
            {display: "操作", width : 200, align: "center"},
            {display: "项目名称", name : "projectID", sortable : true,width : 130,align:"left"},
            {display: "项目别名", width : 100,align:"left"},
            {display: "项目代码库地址", width : 300,align:"left"},
            {display: "项目测试域名", width : 130,align:"left"},
            {display: "项目状态", width : 100,align:"left"}
        ],
        buttons : [
            {name: "添加", bclass: "add", onpress : "projectList.add"}
        ],
        sortname: "projectID",
        sortorder: "desc",
        usepager: true,
        rp: 10,
        useRp: true,
        showTableToggleBtn: true,
        onSubmit: function() {
            var dt = $('#search_form').serializeArray();
            $("#flex").flexOptions({params: dt});
            return true;
        }
    });

    var projectList = {

		load : function(){
			$("#flex").flexReload();
		},
        //搜索
        search: function() {
            var dt = $('#search_form').serializeArray();
            $("#flex").flexOptions({params: dt}).flexReload();
            
        },

        //添加
        add: function() {
            E.open("/quanliadmin/app/project/projectList.pscript?operFlg=2" , "" , {height: 600,width: 980, top: 50, left: 150});
        },
		
		createProject : function(projectID,projectStatus){
			
			$.ajax({
                type: "POST",
                url: "/invokingAjax-backend/project/projectList.ajax?operFlg=3",
                dataType: "JSON",
                data: {'projectID':projectID,'projectStatus':projectStatus},
                success: function( result_obj ) {
					
                    if (result_obj.code == 200) {
						
						 E.alert(result_obj.message, 2, "E.closeWindows");

                    } else {
                        E.alert(result_obj.message);
                    }
                }
            });
		},
		
		createProjectTestEnv : function(projectID,projectStatus){
			
			$.ajax({
                type: "POST",
                url: "/invokingAjax-backend/project/projectList.ajax?operFlg=4",
                dataType: "JSON",
                data: {'projectID':projectID,'projectStatus':projectStatus},
                success: function( result_obj ) {
					
                    if (result_obj.code == 200) {
						
						 E.alert(result_obj.message, 2, "E.closeWindows");

                    } else {
                    	
                        E.alert(result_obj.message);
                    }
                }
            });
		}
    }


</script>

</body>
</html>